<template>
  <div id="centerRight1">
    <dv-scroll-board class="dv-scr-board" :config="config" />
  </div>
</template>

<script>
import { getEquipment } from "@/api/index";
export default {
  props: {
    dataList2: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      config: {
        header: [
          "设备名称",
          "机台号",
          "工单号",
          "料号",
          "班次",
          "加工数量",
          "利用率",
          "责任人",
        ],
        data: [
          [
            "津上B206",
            "A11",
            "23010866",
            "P1047RA02-01000",
            "二工白班",
            "8676",
            "95%",
            "郑玉喜",
          ],
          [
            "津上B206",
            "A12",
            "23010869",
            "P1047RA02-01000",
            "二工白班",
            "5786",
            "92%",
            "胡朝娇",
          ],
          [
            "西铁城A20",
            "A15",
            "23010842",
            "MP-02650B03-E02",
            "二工白班",
            "6788",
            "90%",
            "张利江",
          ],
          [
            "西铁城A20",
            "A26",
            "23010861",
            "AMS036000-1003C3",
            "二工白班",
            "5454",
            "92%",
            "吴志",
          ],
          [
            "西铁城A20",
            "A28",
            "41006783",
            "P09863RPLF-010003",
            "白班",
            "9766",
            "90%",
            "陈超伟",
          ],
        ],
        rowNum: 4, //表格行数
        headerHeight: 40,
        headerBGC: "", //表头
        oddRowBGC: "#173653", //奇数行
        evenRowBGC: "", //偶数行
        // columnWidth: [100, 90, 90, 180, 70, 100, 90, 80],
        columnWidth: [120, 80, 90, 170, 90, 90, 80, 75],
        align: [
          "center",
          "center",
          "center",
          "center",
          "center",
          "center",
          "center",
          "center",
        ],
      },
    };
  },
  watch: {
    dataList2: {
      handler(newVal) {
        this.getrequests();
      },
      deep: true,
    },
  },
  methods: {
    getrequests() {
      let data = [];
      this.dataList2.forEach((item) => {
        data.push([
          item.equipmentName,
          item.equipmentCode,
          item.workOrder,
          item.workOrderMaterial,
          item.schedulingName,
          item.number,
          Math.round(
            (item.onTime /
              (item.onTime + item.noTime + item.ngTime + item.offTime)) *
              100 || 0.0
          ) + "%",
          item.userName,
        ]);
      });
      this.config.data = data;
      this.config = { ...this.config };
    },
  },
  mounted() {
    // this.getrequests();
  },
};
</script>

<style lang="scss" scoped>
::v-deep .dv-scroll-board {
  height: 23.5vh;
  width: 96%;
  margin-left: 2%;
  margin-top: 15px;
  .header {
    font-size: 17px;
    color: #85acef !important;
    text-align: center;
    border-radius: 10px;
  }
  .rows {
    .row-item {
      color: #c6d9f8;
      font-size: 15px;
    }
  }
}
</style>
